package com.tianyang.yukuaifuzs.business.trade.adapter;

import android.text.TextUtils;
import android.widget.TextView;

import androidx.annotation.NonNull;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.tianyang.yukuaifuzs.R;
import com.tianyang.yukuaifuzs.business.trade.bean.EarningsOutput;
import com.tianyang.yukuaifuzs.utils.DateUtils;
import com.tianyang.yukuaifuzs.utils.VerifyUtil;

import java.util.ArrayList;

/**
 * Description：收益
 * Created by xyj on 2024/3/10
 */
public class EarningsAdapter extends BaseQuickAdapter<EarningsOutput, BaseViewHolder> {

    public EarningsAdapter() {
        super(R.layout.item_earnings, new ArrayList<>());
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, EarningsOutput item) {
        if (item != null) {
            helper.setText(R.id.nameTv, VerifyUtil.checkString(item.getRemark()))
                    .setText(R.id.timeTv, "时间：" + DateUtils.formatTime(item.getCreateTime()))
                    .setText(R.id.profitTv, "收益：￥" + VerifyUtil.decimalFormat(item.getAmount()))
                    .setText(R.id.amountTv, VerifyUtil.decimalFormat(item.getReserveOne()));
            TextView settleTypeTv = helper.getView(R.id.settleTypeTv);
            if (TextUtils.equals("1", item.getSec_service())) {
                settleTypeTv.setText("结算方式:合并到账");
            } else {
                settleTypeTv.setText("结算方式:实时到账");
            }
        }
    }
}
